package com.situ.mall.pattern.observer;
//具体的观察者
public class Reader implements Observer{
    private String name;

    public Reader(String name) {
        this.name = name;
    }

    @Override
    public void update(Subject subject, Object obj) {
        System.out.println(name + "收到报纸，推送过来的内容是：" + obj);
        //虽然传入的是父类Subject，但是实际是具体子类NewsPaper
        //可以强制转换成NewsPaper，拿到报纸的具体内容
        NewsPaper newsPaper = (NewsPaper) subject;
        System.out.println(name + "收到报纸，拉去过来的内容是：" + newsPaper.getContent());
    }
}
